package Services;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import DB.TripManager;
import DB.DBInfo;

/**
 *
 * @author Sibrand
 */
@WebService()
public class tripData {

    @WebMethod(operationName = "getTripsMadeBy")
    public int[] getTripsMadeBy(@WebParam(name = "user") String user) {
        TripManager m = new TripManager(DBInfo.getConnection());
        return m.getTripsOwnedBy(user);
    }

    @WebMethod(operationName = "getStart")
    public String getStart(@WebParam(name = "tripId") int tripId) {
        TripManager m = new TripManager(DBInfo.getConnection());
        return m.getStart(tripId);
    }

    @WebMethod(operationName = "getEnd")
    public String getEnd(@WebParam(name = "tripId") int tripId) {
        TripManager m = new TripManager(DBInfo.getConnection());
        return m.getEnd(tripId);
    }

    @WebMethod(operationName = "getName")
    public String getName(@WebParam(name = "tripId") int tripId) {
        TripManager m = new TripManager(DBInfo.getConnection());
        return m.getTripName(tripId);
    }

    @WebMethod(operationName = "getURL")
    public String getURL(@WebParam(name = "tripId") int tripId) {
        return "http://gwtgroep8.didactiek1.edm.uhasselt.be:8080/web/index.jsp?page=trip&amp;tripid=" + tripId;
    }

    @WebMethod(operationName = "getLatestTrips")
    public int[] getLatestTrips() {
        TripManager m = new TripManager(DBInfo.getConnection());
        return m.getLatestTrips();
    }
}
